const express = require('express');
const router = express.Router();
const taskController = require('../controllers/taskController');
const auth = require('../middlewares/auth');

// 获取所有任务不需要认证
router.get('/all', taskController.getAllTasks);

// All task routes require authentication
router.use(auth);

// Task management routes
router.get('/available', taskController.getAvailableTasks);
router.get('/my-tasks', taskController.getUserTasks);
router.get('/latest', taskController.getLatestTasks);
router.post('/:taskId/start', taskController.startTask);
router.put('/:taskId/progress', taskController.updateTaskProgress);
router.post('/:taskId/complete', taskController.completeTask);

module.exports = router; 